home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Apple Guide / Engineering / APISample / APISampleCW / Source / AppleGuide.h next >
Encoding:
C/C++ Source or Header  |  1994-08-23  |  10.1 KB  |  326 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleGuide.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1+  unofficial build.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __APPLEGUIDE__
  18. #define __APPLEGUIDE__
  19.  
  20.  
  21. #ifndef __APPLEEVENTS__
  22. #include <AppleEvents.h>
  23. #endif
  24. /*    #include <Errors.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <Types.h>                                            */
  27. /*    #include <Memory.h>                                            */
  28. /*        #include <MixedMode.h>                                    */
  29. /*    #include <OSUtils.h>                                        */
  30. /*    #include <Events.h>                                            */
  31. /*        #include <Quickdraw.h>                                    */
  32. /*            #include <QuickdrawText.h>                            */
  33. /*    #include <EPPC.h>                                            */
  34. /*        #include <PPCToolbox.h>                                    */
  35. /*            #include <AppleTalk.h>                                */
  36. /*        #include <Processes.h>                                    */
  37. /*            #include <Files.h>                                    */
  38. /*    #include <Notification.h>                                    */
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #if GENERATINGPOWERPC
  45. #pragma options align=mac68k
  46. #endif
  47.  
  48. #ifdef __CFM68K__
  49. #pragma lib_export on
  50. #endif
  51.  
  52. /*
  53.     23-Aug-94 JRP    Add definitions of UInt32, UInt16, and SInt16
  54.                     because Metrowerks' headers do not have them.
  55. */
  56. typedef unsigned long  UInt32;
  57. typedef unsigned short UInt16;
  58. typedef signed   short SInt16;
  59.  
  60. typedef UInt32 AGRefNum;
  61.  
  62. typedef UInt32 AGCoachRefNum;
  63.  
  64. typedef UInt32 AGContextRefNum;
  65.  
  66. struct AGAppInfo {
  67.     AEEventID                        eventId;
  68.     long                            refCon;
  69.     void                            *contextObj;                /* private system field*/
  70. };
  71. typedef struct AGAppInfo AGAppInfo, *AGAppInfoPtr, **AGAppInfoHdl;
  72.  
  73. typedef pascal OSErr (*CoachReplyProcPtr)(Rect *pRect, Ptr name, long refCon);
  74. typedef pascal OSErr (*ContextReplyProcPtr)(Ptr pInputData, Size inputDataSize, Ptr *ppOutputData, Size *pOutputDataSize, AGAppInfoHdl hAppInfo);
  75.  
  76. #if GENERATINGCFM
  77. typedef UniversalProcPtr CoachReplyUPP;
  78. typedef UniversalProcPtr ContextReplyUPP;
  79. #else
  80. typedef CoachReplyProcPtr CoachReplyUPP;
  81. typedef ContextReplyProcPtr ContextReplyUPP;
  82. #endif
  83.  
  84. enum {
  85.     uppCoachReplyProcInfo = kPascalStackBased
  86.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  87.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Rect*)))
  88.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  89.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  90.     uppContextReplyProcInfo = kPascalStackBased
  91.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  92.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  93.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Size)))
  94.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr*)))
  95.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Size*)))
  96.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AGAppInfoHdl)))
  97. };
  98.  
  99. #if GENERATINGCFM
  100. #define NewCoachReplyProc(userRoutine)        \
  101.         (CoachReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCoachReplyProcInfo, GetCurrentArchitecture())
  102. #define NewContextReplyProc(userRoutine)        \
  103.         (ContextReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppContextReplyProcInfo, GetCurrentArchitecture())
  104. #else
  105. #define NewCoachReplyProc(userRoutine)        \
  106.         ((CoachReplyUPP) (userRoutine))
  107. #define NewContextReplyProc(userRoutine)        \
  108.         ((ContextReplyUPP) (userRoutine))
  109. #endif
  110.  
  111. #if GENERATINGCFM
  112. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  113.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCoachReplyProcInfo, (pRect), (name), (refCon))
  114. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  115.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppContextReplyProcInfo, (pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  116. #else
  117. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  118.         (*(userRoutine))((pRect), (name), (refCon))
  119. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  120.         (*(userRoutine))((pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  121. #endif
  122.  
  123.  
  124. enum {
  125.     gestaltAppleGuidePresent    = 31,
  126.     gestaltAppleGuideIsDebug    = 30,
  127.     kAGDefault                    = 0,
  128.     kAGFrontDatabase            = 1,
  129.     kAGNoMixin                    = (-1)
  130. };
  131.  
  132. enum {
  133.     kAGViewFullHowdy            = 1,                            /* Full-size Howdy*/
  134.     kAGViewTopicAreas            = 2,                            /* Full-size Topic Areas*/
  135.     kAGViewIndex                = 3,                            /* Full-size Index Terms*/
  136.     kAGViewLookFor                = 4,                            /* Full-size Look-For (Search)*/
  137.     kAGViewSingleHowdy            = 5,                            /* Single-list-size Howdy*/
  138.     kAGViewSingleTopics            = 6                                /* Single-list-size Topics*/
  139. };
  140.  
  141. enum {
  142.     kAGFileMain                    = 'poco',
  143.     kAGFileMixin                = 'mixn'
  144. };
  145.  
  146. /* To test against AGGetAvailableDBTypes*/
  147. enum AGDBTypeBit {
  148.     kAGDBTypeBitAny                = 0x00000001,
  149.     kAGDBTypeBitHelp            = 0x00000002,
  150.     kAGDBTypeBitTutorial        = 0x00000004,
  151.     kAGDBTypeBitShortcuts        = 0x00000008,
  152.     kAGDBTypeBitAbout            = 0x00000010,
  153.     kAGDBTypeBitOther            = 0x00000080
  154. };
  155.  
  156. typedef UInt16 AGStatus;
  157.  
  158. /* Returned by AGGetStatus*/
  159.  
  160. enum {
  161.     kAGIsNotRunning,
  162.     kAGIsSleeping,
  163.     kAGIsActive
  164. };
  165.  
  166. typedef UInt16 AGWindowKind;
  167.  
  168. /* Returned by AGGetFrontWindowKind*/
  169.  
  170. enum {
  171.     kAGNoWindow,
  172.     kAGAccessWindow,
  173.     kAGPresentationWindow
  174. };
  175.  
  176. /* Error Codes*/
  177. /* Not an enum, because other OSErrs are valid.*/
  178. typedef SInt16 AGErr;
  179.  
  180. /* Apple Guide error codes*/
  181.  
  182. enum {
  183. /* -------------------- Apple event reply codes*/
  184.     kAGErrUnknownEvent            = -2900,
  185.     kAGErrCantStartup            = -2901,
  186.     kAGErrNoAccWin                = -2902,
  187.     kAGErrNoPreWin                = -2903,
  188.     kAGErrNoSequence            = -2904,
  189.     kAGErrNotOopsSequence        = -2905,
  190.     kAGErrReserved06            = -2906,
  191.     kAGErrNoPanel                = -2907,
  192.     kAGErrContentNotFound        = -2908,
  193.     kAGErrMissingString            = -2909,
  194.     kAGErrInfoNotAvail            = -2910,
  195.     kAGErrEventNotAvailable        = -2911,
  196.     kAGErrCannotMakeCoach        = -2912,
  197.     kAGErrSessionIDsNotMatch    = -2913,
  198.     kAGErrMissingDatabaseSpec    = -2914,
  199. /* -------------------- Coach's Chalkboard reply codes*/
  200.     kAGErrItemNotFound            = -2925,
  201.     kAGErrBalloonResourceNotFound = -2926,
  202.     kAGErrChalkResourceNotFound    = -2927,
  203.     kAGErrChdvResourceNotFound    = -2928,
  204.     kAGErrAlreadyShowing        = -2929,
  205.     kAGErrBalloonResourceSkip    = -2930,
  206.     kAGErrItemNotVisible        = -2931,
  207.     kAGErrReserved32            = -2932,
  208.     kAGErrNotFrontProcess        = -2933,
  209.     kAGErrMacroResourceNotFound    = -2934,
  210. /* -------------------- API reply codes*/
  211.     kAGErrAppleGuideNotAvailable = -2951,
  212.     kAGErrCannotInitCoach        = -2952,
  213.     kAGErrCannotInitContext        = -2953,
  214.     kAGErrCannotOpenAliasFile    = -2954,
  215.     kAGErrNoAliasResource        = -2955,
  216.     kAGErrDatabaseNotAvailable    = -2956,
  217.     kAGErrDatabaseNotOpen        = -2957,
  218.     kAGErrMissingAppInfoHdl        = -2958,
  219.     kAGErrMissingContextObject    = -2959,
  220.     kAGErrInvalidRefNum            = -2960,
  221.     kAGErrDatabaseOpen            = -2961,
  222.     kAGErrInsufficientMemory    = -2962
  223. };
  224.  
  225. /* Events*/
  226. /* Not an enum because we want to make assignments.*/
  227. typedef UInt32 AGEvent;
  228.  
  229. /* Handy events for AGGeneral.*/
  230.  
  231. enum {
  232. /* Panel actions (Require a presentation window).*/
  233.     kAGEventDoCoach                = 'doco',
  234.     kAGEventDoHuh                = 'dhuh',
  235.     kAGEventGoNext                = 'gonp',
  236.     kAGEventGoPrev                = 'gopp',
  237.     kAGEventHidePanel            = 'pahi',
  238.     kAGEventReturnBack            = 'gobk',
  239.     kAGEventShowPanel            = 'pash',
  240.     kAGEventTogglePanel            = 'patg'
  241. };
  242.  
  243. /* Functions*/
  244. /* AGClose*/
  245. /* Close the database associated with the AGRefNum.*/
  246. extern pascal AGErr AGClose(AGRefNum *refNum)
  247.  TWOWORDINLINE(0x7011, 0xAA6E);
  248. /* AGGeneral*/
  249. /* Cause various events to happen.*/
  250. extern pascal AGErr AGGeneral(AGRefNum refNum, AGEvent theEvent)
  251.  TWOWORDINLINE(0x700D, 0xAA6E);
  252. /* AGGetAvailableDBTypes*/
  253. /* Return the database types available for this application.*/
  254. extern pascal UInt32 AGGetAvailableDBTypes(void)
  255.  TWOWORDINLINE(0x7008, 0xAA6E);
  256. /* AGGetFrontWindowKind*/
  257. /* Return the kind of the front window.*/
  258. extern pascal AGWindowKind AGGetFrontWindowKind(AGRefNum refNum)
  259.  TWOWORDINLINE(0x700C, 0xAA6E);
  260. /* AGGetFSSpec*/
  261. /* Return the FSSpec for the AGRefNum.*/
  262. extern pascal AGErr AGGetFSSpec(AGRefNum refNum, FSSpec *fileSpec)
  263.  TWOWORDINLINE(0x700F, 0xAA6E);
  264. /* AGGetStatus*/
  265. /* Return the status of Apple Guide.*/
  266. extern pascal AGStatus AGGetStatus(void)
  267.  TWOWORDINLINE(0x7009, 0xAA6E);
  268. /* AGInstallCoachHandler*/
  269. /* Install a Coach object location query handler.*/
  270. extern pascal AGErr AGInstallCoachHandler(CoachReplyUPP coachReplyProc, long refCon, AGCoachRefNum *resultRefNum)
  271.  TWOWORDINLINE(0x7012, 0xAA6E);
  272. /* AGInstallContextHandler*/
  273. /* Install a context check query handler.*/
  274. extern pascal AGErr AGInstallContextHandler(ContextReplyUPP contextReplyProc, AEEventID eventID, long refCon, AGContextRefNum *resultRefNum)
  275.  TWOWORDINLINE(0x7013, 0xAA6E);
  276. /* AGIsDatabaseOpen*/
  277. /* Return true if the database associated with the AGRefNum is open.*/
  278. extern pascal Boolean AGIsDatabaseOpen(AGRefNum refNum)
  279.  TWOWORDINLINE(0x7006, 0xAA6E);
  280. /* AGOpen*/
  281. /* Open a guide database.*/
  282. extern pascal AGErr AGOpen(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, AGRefNum *resultRefNum)
  283.  TWOWORDINLINE(0x7001, 0xAA6E);
  284. /* AGOpenWithSearch*/
  285. /* Open a guide database and preset a search string.*/
  286. extern pascal AGErr AGOpenWithSearch(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, ConstStr255Param searchString, AGRefNum *resultRefNum)
  287.  TWOWORDINLINE(0x7002, 0xAA6E);
  288. /* AGOpenWithSequence*/
  289. /* Open a guide database and display a presentation window sequence.*/
  290. extern pascal AGErr AGOpenWithSequence(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short sequenceID, AGRefNum *resultRefNum)
  291.  TWOWORDINLINE(0x7004, 0xAA6E);
  292. /* AGOpenWithView*/
  293. /* Open a guide database and override the default view.*/
  294. extern pascal AGErr AGOpenWithView(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short viewNum, AGRefNum *resultRefNum)
  295.  TWOWORDINLINE(0x7005, 0xAA6E);
  296. /* AGQuit*/
  297. /* Make Apple Guide quit.*/
  298. extern pascal AGErr AGQuit(void)
  299.  TWOWORDINLINE(0x7010, 0xAA6E);
  300. /* AGRemoveCoachHandler*/
  301. /* Remove the Coach object location query handler.*/
  302. extern pascal AGErr AGRemoveCoachHandler(AGCoachRefNum *resultRefNum)
  303.  TWOWORDINLINE(0x7014, 0xAA6E);
  304. /* AGRemoveContextHandler*/
  305. /* Remove the context check query handler.*/
  306. extern pascal AGErr AGRemoveContextHandler(AGContextRefNum *resultRefNum)
  307.  TWOWORDINLINE(0x7015, 0xAA6E);
  308. /* AGStart*/
  309. /* Start up Apple Guide in the background.*/
  310. extern pascal AGErr AGStart(void)
  311.  TWOWORDINLINE(0x700A, 0xAA6E);
  312.  
  313. #ifdef __CFM68K__
  314. #pragma lib_export off
  315. #endif
  316.  
  317. #if GENERATINGPOWERPC
  318. #pragma options align=reset
  319. #endif
  320.  
  321. #ifdef __cplusplus
  322. }
  323. #endif
  324.  
  325. #endif /* __APPLEGUIDE__ */
  326.